package com.hps.boot.gradle.service.impl;

import com.hps.boot.gradle.entity.Order;
import com.hps.boot.gradle.entity.User;
import com.hps.boot.gradle.service.OrderService;
import com.hps.boot.gradle.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author heps
 * @since 2020/6/23 19:31
 */
@AllArgsConstructor
@Service
public class OrderServiceImpl implements OrderService {

  private final UserService userService;

  @Override
  public Order createOrder() {
    Order order = new Order();
    order.setId(1L);
    order.setDetail("matebook 14");

    User user = userService.findById(1L);
    order.setUserId(user.getId());
    order.setUsername(user.getUsername());
    return order;
  }
}
